function frprint(name, options = {}) {
  let reportlets = [];
  if (Array.isArray(name)) {
    reportlets = name.map(({ name, options }) => ({
      reportlet: name,
      ...options
    }));
  } else {
    reportlets = [{ reportlet: name, ...options }];
  }
  window.FR.doURLPrint({
    printUrl: '/webroot/decision/view/report',
    printType: 0,
    isPopup: false,
    data: {
      reportlets: reportlets
    }
  });
}

export { frprint };
